package com.qingcheng.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.qingcheng.pojo.seckill.SeckillGoods;
import com.qingcheng.service.seckill.SeckillGoodsService;
import com.qingcheng.util.DateUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

/**
 * @Author: LDeng
 * @Date: 2020-07-13 9:33
 */
@RestController
@RequestMapping("/seckill/goods")
public class SeckillGoodsController {

    @Reference
    private SeckillGoodsService seckillGoodsService;

    //加载所有时间菜单
    @RequestMapping("/menus")
    public List<Date> loadMenus(){
       return DateUtil.getDateMenus();
    }


    //加载对应时区的秒杀商品
    @GetMapping(value="/list")
    public List<SeckillGoods> list(String time){
        System.out.println(time);
        return seckillGoodsService.list(time);
    }

    //根据商品id查询商品详情
    @GetMapping(value = "/one")
    public SeckillGoods one(String time,long id){
        return seckillGoodsService.one(time,id);
    }


}
